1. Field of the Invention
The present invention relates generally to a method for encoding an image using color space estimation. More particularly, the present invention relates to an image encoding method using the color space estimation, which can compress the image without loss by ruling out similarity between pixels.
2. Description of the Related Art
Video encoding includes a lossy compression scheme and a lossless compression scheme. To compress the video without loss, it is general to entropy-encode an error signal which is a difference between an estimated block according to an estimation result and a current block, rather than applying Discrete Cosine Transform (DCT) or quantization.
The conventional lossless compression scheme uses the pixel based compression. Given that a pixel to currently encode or decode is 1x, a pixel on the left is Ra, a pixel above Ix is Rb, a top-left pixel is Rc, and a top-right pixel is Rd, the encoding is performed using the relation between the neighbor pixels and the current pixel. When all of the neighbor pixel values are the same, the conventional lossless compression scheme operates in a Run mode. When the neighbor pixel values are inconsistent, the conventional lossless compression method operates in a Regular mode.
In the Run mode, when the number of fixed-length Runs is repeated, the method encodes/decodes a bit indicative of the occurrence of the Runs as many as the fixed length and then checks whether the Run is continued. When all of the neighbor pixel values do not match, the inconsistent pixel value is encoded. In so doing, the encoding method is similar to the Regular mode.
In the Regular mode, the encoding is performed using how different the neighbor pixel values are. First, difference values of the neighbor pixel values are calculated. Three difference values of D1=Rd−Rb, D2=Rb−Rc, and D3=Rc−Ra are used, and the acquired D1, D2 and D3 are quantized using a particular threshold. The quantization value has 9 cases ranging −3˜3. D1, D2 and D3 each have 9×9×9 cases. However, since both of the negative number and the positive number are used as the same value, the number of cases is reduced by half. Accordingly, the encoding varies according to 365 cases.
When a most similar value to the current pixel is set to an estimation value Px, Px can be calculated as follows:
if (Rc >= max(Ra, Rb))Px = min(Ra, Rb);else {If (Rc <= min(Ra, Rb))Px = max(Ra, Rb);elsePx = Ra + Rb − Rc;}
The encoded or decoded value is a differential value from the difference between the calculated estimation value Px and the current(Ix) pixel value. The differential value can be a negative number. To make it to a positive number, a particular value is added. For example, as for a 8-bit depth value, 256 is added to modify the range of the differential value to 0˜255.
Next, this value is modified into the normal range. As for the value more than half of the entire displacement; that is, as for 8 bits, the value greater than 128 is added with −128 and its displacement is modified to −128˜127. The substantial bit sequence coding adopts a limited golomb code.
The conventional lossless compression method as discussed above encodes or decodes using only the neighbor pixel values, and the value used to encode/decode the current pixel is only 4 neighbor pixel values. Thus, a new method for raising the encoding and decoding efficiency is demanded.